package com.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the product database table.
 * 
 */
@Entity
@Table(name="product")
@NamedQuery(name="Product.findAll", query="SELECT p FROM Product p")
public class Product implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String pid;

	private String barcode;

	private String cateid;

	private int company;

	private BigDecimal costprice;

	@Temporal(TemporalType.DATE)
	private Date expdate;

	private String img;

	private String model;

	private String pname;

	private BigDecimal price;

	@Temporal(TemporalType.DATE)
	private Date prodate;

	private int state;

	private BigDecimal weight;

	//bi-directional many-to-one association to Delivery
	@OneToMany(mappedBy="product")
	private List<Delivery> deliveries;

	//bi-directional many-to-one association to Orderdetail
	@OneToMany(mappedBy="product")
	private List<Orderdetail> orderdetails;

	//bi-directional many-to-one association to Returndetail
	@OneToMany(mappedBy="product")
	private List<Returndetail> returndetails;

	//bi-directional many-to-one association to Senddetail
	@OneToMany(mappedBy="product")
	private List<Senddetail> senddetails;

	//bi-directional many-to-one association to Xiangrd
	@OneToMany(mappedBy="product")
	private List<Xiangrd> xiangrds;

	public Product() {
	}

	public String getPid() {
		return this.pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	public String getBarcode() {
		return this.barcode;
	}

	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	public String getCateid() {
		return this.cateid;
	}

	public void setCateid(String cateid) {
		this.cateid = cateid;
	}

	public int getCompany() {
		return this.company;
	}

	public void setCompany(int company) {
		this.company = company;
	}

	public BigDecimal getCostprice() {
		return this.costprice;
	}

	public void setCostprice(BigDecimal costprice) {
		this.costprice = costprice;
	}

	public Date getExpdate() {
		return this.expdate;
	}

	public void setExpdate(Date expdate) {
		this.expdate = expdate;
	}

	public String getImg() {
		return this.img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public String getModel() {
		return this.model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getPname() {
		return this.pname;
	}

	public void setPname(String pname) {
		this.pname = pname;
	}

	public BigDecimal getPrice() {
		return this.price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public Date getProdate() {
		return this.prodate;
	}

	public void setProdate(Date prodate) {
		this.prodate = prodate;
	}

	public int getState() {
		return this.state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public BigDecimal getWeight() {
		return this.weight;
	}

	public void setWeight(BigDecimal weight) {
		this.weight = weight;
	}

	public List<Delivery> getDeliveries() {
		return this.deliveries;
	}

	public void setDeliveries(List<Delivery> deliveries) {
		this.deliveries = deliveries;
	}

	public Delivery addDelivery(Delivery delivery) {
		getDeliveries().add(delivery);
		delivery.setProduct(this);

		return delivery;
	}

	public Delivery removeDelivery(Delivery delivery) {
		getDeliveries().remove(delivery);
		delivery.setProduct(null);

		return delivery;
	}

	public List<Orderdetail> getOrderdetails() {
		return this.orderdetails;
	}

	public void setOrderdetails(List<Orderdetail> orderdetails) {
		this.orderdetails = orderdetails;
	}

	public Orderdetail addOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().add(orderdetail);
		orderdetail.setProduct(this);

		return orderdetail;
	}

	public Orderdetail removeOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().remove(orderdetail);
		orderdetail.setProduct(null);

		return orderdetail;
	}

	public List<Returndetail> getReturndetails() {
		return this.returndetails;
	}

	public void setReturndetails(List<Returndetail> returndetails) {
		this.returndetails = returndetails;
	}

	public Returndetail addReturndetail(Returndetail returndetail) {
		getReturndetails().add(returndetail);
		returndetail.setProduct(this);

		return returndetail;
	}

	public Returndetail removeReturndetail(Returndetail returndetail) {
		getReturndetails().remove(returndetail);
		returndetail.setProduct(null);

		return returndetail;
	}

	public List<Senddetail> getSenddetails() {
		return this.senddetails;
	}

	public void setSenddetails(List<Senddetail> senddetails) {
		this.senddetails = senddetails;
	}

	public Senddetail addSenddetail(Senddetail senddetail) {
		getSenddetails().add(senddetail);
		senddetail.setProduct(this);

		return senddetail;
	}

	public Senddetail removeSenddetail(Senddetail senddetail) {
		getSenddetails().remove(senddetail);
		senddetail.setProduct(null);

		return senddetail;
	}

	public List<Xiangrd> getXiangrds() {
		return this.xiangrds;
	}

	public void setXiangrds(List<Xiangrd> xiangrds) {
		this.xiangrds = xiangrds;
	}

	public Xiangrd addXiangrd(Xiangrd xiangrd) {
		getXiangrds().add(xiangrd);
		xiangrd.setProduct(this);

		return xiangrd;
	}

	public Xiangrd removeXiangrd(Xiangrd xiangrd) {
		getXiangrds().remove(xiangrd);
		xiangrd.setProduct(null);

		return xiangrd;
	}

}